﻿using GalaSoft.MvvmLight;
using LightOMator.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace LightOMator.ViewModel
{
    public class ObservableFade : ObservableObject
    {
        private Color _color;
        public Color Color
        {
            get { return _color; }
            set
            {
                if (value != _color)
                {
                    _color = value;
                    RaisePropertyChanged();
                }
            }
        }

        private long _fadeInTimeMs;
        public long FadeInTimeMs
        {
            get { return _fadeInTimeMs; }
            set
            {
                if (value != _fadeInTimeMs)
                {
                    _fadeInTimeMs = value;
                    RaisePropertyChanged();
                }
            }
        }

        private long _keepOnTimeMs;
        public long KeepOnTimeMs
        {
            get { return _keepOnTimeMs; }
            set
            {
                if (value != _keepOnTimeMs)
                {
                    _keepOnTimeMs = value;
                    RaisePropertyChanged();
                }
            }
        }

        public ObservableFade()
        {
        }

        public ObservableFade(Fade fade)
        {
            _color = fade.Color;
            _fadeInTimeMs = fade.FadeInTimeMs;
            _keepOnTimeMs = fade.KeepOnTimeMs;
        }

        public Fade ToFade()
        {
            return new Fade
            {
                Color = _color,
                FadeInTimeMs = _fadeInTimeMs,
                KeepOnTimeMs = _keepOnTimeMs
            };
        }
    }
}
